package bookstore.model;

import javax.persistence.Entity;
import java.util.Arrays;
import java.util.Objects;
import java.util.Set;

@Entity
public class User {
    private Long userid;
    private String username;
    private String email;
    private String tel;
    private byte[] pwd;
    private boolean activate;
    private boolean available;
    private boolean staff;

    public Long getUserid() {
        return userid;
    }

    public void setUserid(Long userid) {
        this.userid = userid;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public byte[] getPwd() {
        return pwd;
    }

    public void setPwd(byte[] pwd) {
        this.pwd = pwd;
    }

    public boolean getActivate() {
        return activate;
    }

    public void setActivate(boolean activate) {
        this.activate = activate;
    }

    public boolean getAvailable() {
        return available;
    }

    public void setAvailable(boolean available) {
        this.available = available;
    }

    public boolean getStaff() {
        return staff;
    }

    public void setStaff(boolean staff) {
        this.staff = staff;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return activate == user.activate &&
                available == user.available &&
                staff == user.staff &&
                Objects.equals(userid, user.userid) &&
                Objects.equals(username, user.username) &&
                Objects.equals(email, user.email) &&
                Objects.equals(tel, user.tel) &&
                Arrays.equals(pwd, user.pwd);
    }

    @Override
    public int hashCode() {

        int result = Objects.hash(userid, username, email, tel, activate, available, staff);
        result = 31 * result + Arrays.hashCode(pwd);
        return result;
    }

}
